package cn.com.utt.common.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.com.utt.common.log.doLog;
import cn.com.utt.common.mapper.UserMapper;
import cn.com.utt.common.service.UserService;
import cn.com.utt.common.util.Tips;
import cn.com.utt.common.vo.RestResult;
import cn.com.utt.common.vo.Role;
import cn.com.utt.common.vo.User;

@Service("userService")
public class UserServiceImpl implements UserService{
	
	@Autowired
	private UserMapper userMapper;
	
	@Override
	public void save(User user) {
		userMapper.save(user);
	}

	@Override
	public List<Role> queryRolesById(long id) {
		return userMapper.queryRolesById(id);
	}

	@Override
	public User queryById(long id) {
		return userMapper.queryById(id);
	}

	@Override
	@doLog(description = Tips.LogModifyPersonalInformation, key = { "" })
	public RestResult update(User user) {
		RestResult result=new RestResult();
		userMapper.update(user);
		return result;
	}

	@Override
	public User queryByUsernameOrEmail(String value) {
		return userMapper.queryByUsernameOrEmail(value);
	}
}
